<#include "../teacherNavigation/index.html">
<#if message?exists>
	${message}
</#if>




 <script src="//cdn.bootcss.com/bootstrap-validator/0.5.3/js/bootstrapValidator.js"></script>
 <link href="//cdn.bootcss.com/bootstrap-validator/0.5.3/css/bootstrapValidator.min.css" rel="stylesheet" />
				<div class="main-content">
					<div class="breadcrumbs" id="breadcrumbs">
						<script type="text/javascript">
							try{ace.settings.check('breadcrumbs' , 'fixed')}catch(e){}
						</script>

						<ul class="breadcrumb">
							<li>
								<i class="icon-home home-icon"></i>
								<a href="${contextPath}/admin">教学日历服务平台教师首页</a>
							</li>
							<li class="active">批量学生导入</li>
						</ul><!-- .breadcrumb -->
					</div>
                   <div class="page-content">
                   
                   <form action="${contextPath}/teacher/manyStudent" method="post"enctype="multipart/form-data">
                   
                

                     <div class="form-group" style="margin-left:33%;">
				       <label>学期</label>
				       <br>
				       <select id="year" name="year"
								class="form-control" onchange="change(this)" style="width:50%;"><#if
								listAll??> <#list listAll as mn><option value="${mn}">${mn}</option> </#list> </#if>
						
					  </select> 
				     </div>
				      <div class="form-group"style="margin-left:33%;">
				       <label>课程名</label>
				       <br>
				        <select id="courseName" name="courseName"
								class="form-control" style="width:50%;">
						
					  </select> 
				     </div>
				     <div class="form-group"style="margin-left:33%;">
				       <label>学生学号</label>
				       <div class="filediv" style="width:100%">
					   <input type="file" name="excelFile" style="width:100%"class="input-medium disabled" multiple >
				      </div>
				      
				     </div>
				     <div class="form-group"style="margin-left:33%;">
				       <button type="submit" name="submit" class="btn btn-primary">添加</button>
				     </div>
				     
			
				   </form>			
				   </div><!-- /.page-content -->
				   	<script type="text/javascript">
				  //yan:这个js不能移动,将获取到的课程放入下拉列表
				/* 	function loadAd(data,status)
					{
						alert("1");
						var html1 = '<option value = "';
						var html2 = '" >';
						var html3 = '</option>'
						var value = data.split(',');

						var selectHtml = "";
						
						for(var i = 0 ;i<value.length;i++)
						{
							selectHtml += html1;
							selectHtml += value[i];
							selectHtml += html2;
							selectHtml += value[i];
							selectHtml += html3;
							
						}
						
						document.getElementById("courseName").innerHTML = selectHtml;

						
					} */
					function change(obj)
					{
						var year =obj.value ; 

						$.ajax({
							type:"post",				
							url:"${contextPath}/teacher/findCourseByYear",
							data:{year:year}, 
							dataType: "json", 
							error:function(err){alert(err);},
							success:function loadAd(data)
							{
								
								$('select#courseName').empty();
								 for (var i = data.length - 1; i >= 0; i--) {
								 $('select#courseName').prepend('<option value="' + data[i]+ '">' + data[i] + '</option>')
								   };
							   $('select#courseName').prepend('<option value="0">请选择</option>');
							    
								/* var html1 = '<option value = "';
								var html2 = '" >';
								var html3 = '</option>'
								var value = data.split(',');
								alert(value);
								var selectHtml = "";
								
								for(var i = 0 ;i<data.length;i++)
								{
									selectHtml += html1;
									selectHtml += value[i];
									selectHtml += html2;
									selectHtml += value[i];
									selectHtml += html3;
									
								} */
							
	
							},
						});
						
						
					}
					/* function onload()
					{
						$.ajax({
							type:"post",
							url:"${contextPath}/admin/finance/findFileByYear?year="+(${year!"2013"}),
							data:"",
							error:function(err){alert(err);},
							success:loadAd
						});
						
						document.getElementById('year')[(${year!"2013"}-1)].selected = true;
					} */
					
					/*  function fillFilename(obj)
					 {
						 
					     document.getElementById("filename").value = obj.value;
					 }
					 */
					/* onload(); */
					
       </script >
		</div><!-- /.main-container-inner -->

			<a href="#" id="btn-scroll-up" class="btn-scroll-up btn btn-sm btn-inverse">
				<i class="icon-double-angle-up icon-only bigger-110"></i>
			</a>
		<!-- /.main-container -->

		